<template>
  <div>
    <Form ref="tabParamForm" :model="infoForm" label-position="left" :label-width="80">

      <FormItem label="值班员：">
        <Input type="text" v-model="infoForm.dutyUser" clearable placeholder="请输入值班员"></Input>
      </FormItem>

      <!--<FormItem label="补录员：">-->
      <!--<Input type="text" v-model="infoForm.recordUser" clearable placeholder="请输入补录员"></Input>-->
      <!--</FormItem>-->

      <FormItem label="发货地：">
        <Input type="text" v-model="infoForm.sendAddress" clearable placeholder="请输入发货地"></Input>
      </FormItem>

      <FormItem label="送货地址" v-if="orderType==='mainOrder'">
        <Select v-model="infoForm.arriveAddress" placeholder="请选择送货地址" clearable>
          <Option v-for="item in addressList" :value="item.address" :key="item.address">{{ item.address }}</Option>
        </Select>
      </FormItem>

      <FormItem label="送货地址" v-if="orderType==='subOrder'">
        <Select v-model="infoForm.shippingAddress" placeholder="请选择送货地址" clearable>
          <Option v-for="item in addressList" :value="item.address" :key="item.address">{{ item.address }}</Option>
        </Select>
      </FormItem>
      <FormItem label="对位时间：">
        <DatePicker v-model="infoForm.paraPositionTime" type="datetime" placeholder="请选择对位时间"></DatePicker>
      </FormItem>
    </Form>
    <div class="xlinkModal-footer">
      <Button type="primary" @click="saveInfo">确认提交</Button>
      <Button @click="cancel">取消</Button>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'duty-opera-modal',
    data () {
      let infoForm = {
        paraPositionTime: '', // 对位时间
        arriveAddress: '', // 到达地址
        shippingAddress: '', // 到达地址
        sendAddress: '', // 发送地址
        dutyUser: '', // 值班员
        recordUser: ''// 补录员
      }
      let datas = {infoForm}
      return datas
    },
    computed: {},
    props: {
      addressList: {
        type: Array,
        default () {
          return []
        }
      },
      orderType: {
        type: String,
        default () {
          return ''
        }
      }
    },
    methods: {
      saveInfo () {
        if (this.tabStatus === 'subOrder') {
          delete this.infoForm.arriveAddress
        } else if (this.tabStatus === 'mainOrder') {
          delete this.infoForm.shippingAddress
        }
        if (!this.infoForm.dutyUser) {
          this.$Notice.error({
            title: '警告',
            desc: '值班员必填'
          })
          return false
        }
        this.$emit('submitChangeInfo', this.infoForm)
      },
      cancel () {
        this.$emit('closeChangeInfo')
      }
    },
    created () {
    },
    mounted () {
    },
    watch: {},
    components: {}
  }
</script>

<style scoped>

</style>
